

import java.util.ArrayList;

/**
 * @author Hitec
 *
 */
public class Primes {
	
	public static ArrayList<Integer> primeFactors(int number) {
		
		ArrayList<Integer> primeFactors = new ArrayList<Integer>();
		
		Primes.getPrimeFactors(number, 2, primeFactors);
		
		return primeFactors;
	}

	private static void getPrimeFactors(int number, int factor,
			ArrayList<Integer> primeFactors) {

		while(0 != number % factor)
			factor++;
		
		primeFactors.add(factor);
		
		if(number > factor)
			Primes.getPrimeFactors(number / factor, factor, primeFactors);
	}

}
